<?php
	defined( '_JEXEC' ) or die( 'Restricted access' );
	class ContratosViewContrato 
	{
		function setContratosToolbar()
		{
			JToolBarHelper::title( JText::_( 'Administrador Contratos' ), 'generic.png' );
			JToolBarHelper::publishList();
			JToolBarHelper::unpublishList();
			JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy' );
			JToolBarHelper::deleteList();
			JToolBarHelper::editListX();
			JToolBarHelper::addNewX();
			JToolBarHelper::preferences('com_contratos', '200');
			JToolBarHelper::help( 'screen.contratos' );
		}
		
		function setContratoToolbar()
		{
			$task = JRequest::getVar( 'task', '', 'method', 'string');
	
			JToolBarHelper::title( $task == 'add' ? JText::_( 'Banner' ) . ': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>' : JText::_( 'Banner' ) . ': <small><small>[ '. JText::_( 'Edit' ) .' ]</small></small>', 'generic.png' );
			JToolBarHelper::save( 'save' );
			JToolBarHelper::apply('apply');
			JToolBarHelper::cancel( 'cancel' );
			JToolBarHelper::help( 'screen.banners.edit' );
		}
		
		function contratos( &$rows  )
		{
			ContratosViewContrato::setContratosToolbar();
			JHTML::_('behavior.tooltip');
			?>
				<form action="index.php?option=com_contratos" method="post" name="adminForm">
				<table class="adminlist">
				<thead>
				<tr>
				   <th width="20">
						<?php echo JText::_( 'Id.' ); ?>
					</th>
					<th width="20">
						<input type="checkbox" name="toggle" value=""  onclick="checkAll(<?php echo count( $rows ); ?>);" />
					</th>			
				   <th>Codigo </th>
				   <th>Descripcion</th>
				   <th>Fecha Inicio</th>
				   <th>Fecha Fin</th>
				   <th>Monto</th>
				   <th>Fecha Creacion</th>
				   
				</tr>
				</thead>
				<tbody>
				<?php
				    $n =count( $rows );
				    for ($i=0; $i < $n; $i++)
				    {
				        $row =& $rows[$i];
				        $link		= JRoute::_( 'index.php?option=com_contratos&task=edit&id[]='. $row->id );
				        $checked		= JHTML::_('grid.checkedout',   $row, $i );
				        ?>
						<tr>
						   <td> <?php echo $row->id; ?> </td>
						   <td align="center">
								<?php echo $checked; ?>
						   </td>
						   <td>
						   	<span class="editlinktip hasTip" title="<?php echo JText::_( 'Modificar' );?>::<?php echo htmlspecialchars($row->codigo); ?>">
								<a href="<?php echo $link; ?>">
								<?php echo htmlspecialchars($row->codigo); ?></a>
							</span> 
						   </td>
						   <td><?php echo $row->descripcion; ?> </td>
						   <td><?php echo $row->fechainicio; ?> </td>
						   <td><?php echo $row->fechafin; ?> </td>
						   <td><?php echo $row->monto; ?> </td>
						   <td><?php echo $row->fechacreacion; ?> </td>
						</tr>
						<?php
				    }
				?>
				</tbody>
				</table>
				<input type="hidden" name="c" value="contrato" />
				<input type="hidden" name="option" value="com_contratos" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="boxchecked" value="0" />
				<?php echo JHTML::_( 'form.token' ); ?>
				</form>
			<?php 
		}
		
		function contrato ( $row )
		{
			ContratosViewContrato::setContratoToolbar();
			JRequest::setVar( 'hidemainmenu', 1 );
			?>
			<form action="index.php" method="post" name="adminForm">

			<div class="col100">
				<fieldset class="adminform">
					<legend><?php echo JText::_( 'Detalles' ); ?></legend>
	
					<table class="admintable">
					<tbody>
						<tr>
							<td width="20%" class="key">
								<label for="descripcion">
									<?php echo JText::_( 'Descripion' ); ?>:
								</label>
							</td>
							<td width="80%">
								<input class="inputbox" type="text" name="descripcion" id="descripcion" size="50" value="<?php echo $row->descripcion;?>" />
							</td>
						</tr>
						<tr>
							<td width="20%" class="key">
								<label for="codigo">
									<?php echo JText::_( 'Codigo' ); ?>:
								</label>
							</td>
							<td width="80%">
								<input class="inputbox" type="text" name="alias" id="codigo" size="50" value="<?php echo $row->codigo;?>" />
							</td>
						</tr>
					</tbody>
					</table>
				</fieldset>
			</div>
			<div class="clr"></div>
	
			<input type="hidden" name="c" value="contrato" />
			<input type="hidden" name="option" value="com_contratos" />
			<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
			<input type="hidden" name="task" value="" />
			<?php echo JHTML::_( 'form.token' ); ?>
			</form>
			<?php
		}
			
	}
?>